package cn.me.alphamq.common.enumeration;

/**
 * 推送业务消息的结果的状态
 *
 * @author f
 */
public enum PushStatusEnum {
    SUCCESS(0, "推送成功"),
    FAIL(1, "推送失败");

    // 根据枚举的 code 属性获取枚举
    public static PushStatusEnum of(int code) {
        for (PushStatusEnum status : PushStatusEnum.values()) {
            if (status.code == code) {
                return status;
            }
        }
        throw new RuntimeException("invalid push status code: " + code);
    }

    private final int code;
    private final String desc;

    PushStatusEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
